package com.chen.back.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author chen
 * @date @{DATE} -8:10
 **/

@Configuration
public class RedissonConfig {

    @Bean(destroyMethod="shutdown")
    public RedissonClient redisson() throws IOException {
        Config config =new Config();
        config.useClusterServers()
                .addNodeAddress( "redis://192.168.229.129:6381",
                        "redis://192.168.229.129:6382",
                        "redis://192.168.229.129:6383",
                        "redis://192.168.229.129:6384",
                        "redis://192.168.229.129:6385",
                        "redis://192.168.229.129:6386");
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }
}
